package day1105.second;

import day1105.common.MyUtil;
import day1105.common.Student;

import java.util.List;
import java.util.stream.Collectors;

import static day1105.common.MyUtil.printLine;

/**
 * @author Mr.ma
 * @since 2022/11/6 16:49
 **/
public class DistinctTest {
    public static void main(String[] args) {
        List<Student> studentList = MyUtil.createStudentList();
        studentList.stream().forEach(System.out::println);
        printLine("获取学生所在城市的集合，要求去重");
        List<String> stuCities = studentList.stream().map(Student::getCity).distinct().collect(Collectors.toList());
        System.out.println("stuCities = " + stuCities);
    }
}
